package com.wry.controller;

import com.wry.dto.StockDeductedDTO;
import com.wry.service.StockApiService;
import com.wry.util.ApiResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <h1>  <h1>
 *
 * @author 魏如元
 * @since 2022/10/10
 */
@RequestMapping("stock")
@RestController
public class StockController {

    @Resource
    private StockApiService stockApiService;

    @PostMapping("deducted")
    public ApiResult<String> accountDeducted(@RequestBody StockDeductedDTO deductedDTO){
        stockApiService.accountDeducted(deductedDTO);
        return ApiResult.SUCCESS("库存扣减成功！");
    }
}
